package com.doctcloud.hisinfo.histable.domain.comm;

import com.baomidou.mybatisplus.annotation.TableName;
import com.doctcloud.common.core.annotation.Excel;
import com.doctcloud.common.core.annotation.TableDesc;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

import static com.doctcloud.common.core.utils.StringUtils.trim;

/**
 * @ClassName 药品基础信息
 * @Author samula
 * @Descripe product by com.doctcloud
 * @Data 2025-09-23 1:21
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(of = {"drugStdCode", "drugCode", "drugSpec", "firmId"})
@ToString
@TableDesc("药品字典")
public class DrugBasicInfoDo  implements Serializable {
    private static final long serialVersionUID = 1L;
    @Excel(name="药品唯一码")
    private String drugStdCode;
    @Excel(name="自定义药品名")
    @NotBlank(message = "自定义药品名不能为空")
    /** 默认继承DrugDict中的通用名 */
    private String drugName;
    @Excel(name="通用名代码")
    @NotBlank(message = "通用名代码不能为空")
    private String drugCode;
    @Excel(name="药品规格")
    @NotBlank(message = "药品规格不能为空")
    private String drugSpec;
    @Excel(name="药品厂家简写")
    @NotBlank(message = "药品厂家简写不能为空")
    private String firmId;
    @Excel(name="最小单位")
    @NotBlank(message = "最小单位不能为空")
    private String drugUnit;
    @Excel(name="数量(流通包装)")
    @Positive(message = "数量(流通包装)必须大于0")
    private Integer minPack;
    @Excel(name="单位(流通包装)")
    @NotBlank(message = "单位(流通包装)不能为空")
    private String minPackUnit;
    @Excel(name="最小使用剂量")
    @Positive(message = "最小使用剂量必须大于0")
    private Double dosePerUnit;
    @Excel(name="最小使用剂量单位")
    @NotBlank(message = "最小使用剂量单位不能为空")
    private String doseUnit;
    @Excel(name="在用标记")
    private Integer validInd;
    @Excel(name="创建时间")
    private Date createDate;
    @Excel(name="更新时间")
    private Date updateDate;

    @Data
    public static class primaryKey {
        private final String drugStdCode;
        public primaryKey(String drugStdCode) {
            this.drugStdCode = drugStdCode;
        }
    }

    public void setDrugStdCode(String drugStdCode) {
        this.drugStdCode = trim(drugStdCode);
    }

    public void setDrugName(String drugName) {
        this.drugName = trim(drugName);
    }

    public void setDrugCode(String drugCode) {
        this.drugCode = trim(drugCode);
    }

    public void setDrugSpec(String drugSpec) {
        this.drugSpec = trim(drugSpec);
    }

    public void setFirmId(String firmId) {
        this.firmId = trim(firmId);
    }

    public void setDrugUnit(String drugUnit) {
        this.drugUnit = trim(drugUnit);
    }

    public void setMinPackUnit(String minPackUnit) {
        this.minPackUnit = trim(minPackUnit);
    }

    public void setDoseUnit(String doseUnit) {
        this.doseUnit = trim(doseUnit);
    }
}
